package com.cqw.mq;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-09-08 15:19
 * @Description:
 */
@RestController
@RequestMapping("/mq")
public class MqTestController {

    @Resource
    private MqProvider mqProvider;


    @GetMapping("/hello")
    public String hello() {
        mqProvider.model1();
        System.out.println("直连模式：发送消息成功");
        return "OK";
    }


    @GetMapping("/fanout")
    public String fanout() {
        mqProvider.model2();
        System.out.println("广播模式：发送消息成功");
        return "OK";
    }

    @GetMapping("/direct")
    public String direct() {
        mqProvider.model3();
        System.out.println("Direct模式：发送消息成功");
        return "OK";
    }

    @GetMapping("/topic")
    public String topic() {
        mqProvider.model4();
        System.out.println("Topic模式：发送消息成功");
        return "OK";
    }

    @GetMapping("/deadly")
    public String deadly() {
        mqProvider.model5();
        System.out.println("延时消息：发送消息成功");
        return "OK";
    }


}
